import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { lotplaceVO, lotplaceForm, lotplaceQuery } from '@/api/parkinglot/lotPlace/types';
import {  parkPlaceQuery } from '@/api/park/park-place/types';

/**
 * 查询停车场-车位列表
 * @param query
 * @returns {*}
 */

export const listlotplace = (query?: lotplaceQuery): AxiosPromise<lotplaceVO[]> => {
  return request({
    url: '/parkinglot/lotPlace/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停车场-车位详细
 * @param parkingLotPlaceId
 */
export const getlotplace = (parkingLotPlaceId: string | number): AxiosPromise<lotplaceVO> => {
  return request({
    url: '/parkinglot/lotPlace/' + parkingLotPlaceId,
    method: 'get'
  });
};

/**
 * 新增停车场-车位
 * @param data
 */
export const addlotplace = (data: lotplaceForm) => {
  return request({
    url: '/parkinglot/lotPlace',
    method: 'post',
    data: data
  });
};

/**
 * 修改停车场-车位
 * @param data
 */
export const updatelotplace = (data: lotplaceForm) => {
  return request({
    url: '/parkinglot/lotPlace',
    method: 'put',
    data: data
  });
};

/**
 * 删除停车场-车位
 * @param parkingLotPlaceId
 */
export const dellotplace = (parkingLotPlaceId: string | number | Array<string | number>) => {
  return request({
    url: '/parkinglot/lotPlace/' + parkingLotPlaceId,
    method: 'delete'
  });
};

/**
 *
 * @param parkPlaceQuery
 */
export const parkTree = (query?: parkPlaceQuery) => {
  return request({
    url: '/park/park-place/parkTree',
    method: 'get',
    params: query
  });
};
